<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<%@ include file="/common/taglibs.jsp" %>
<head>
    <title>栏目</title>
    <title>Title</title>
    <link rel="stylesheet" href="/assets/admin/css/pintuer.css">
    <link rel="stylesheet" href="/assets/admin/css/admin.css">
    <script type="text/javascript" src="/assets/js/myjs/jquery-3.4.1.js"></script>
    <script type="text/javascript" src="/assets/admin/js/pintuer.js"></script>
</head>
<body>

<c:set var="pgfather" scope="page" value="${father}"/>

<c:set var="yhref" scope="page" value="${ctx}/directory/sonFindBySql?fatherId=${pgfather.fatherId}"/>

<c:set var="nhref" scope="page" value="${ctx}/directory/findBySql"/>

<div class="panel admin-panel">
    <div class="padding border-bottom">
        <ul class="search" style="padding-left: 10px">
            <li>
                <a class="button border-main icon-plus-square-o "
                   href="${ctx}/directory/addson?fatherId=${pgfather.rowId}">新增类目</a>
            </li>
            <li>
                <a class="button border-main icon-backward "
                   href="${pgfather.fatherId != -1 ? yhref : nhref }">返回上级
                    : ${superFather.fatherId != null ? superFather.dirName : "主页" }</a>
            </li>
            <li>
                <a class="button win-refresh icon-refresh ">
                    当前页面：${pgfather.dirName}</a>
            </li>
        </ul>
    </div>


    <table class="table table-hover text-center">
        <tr>
            <th>ID</th>
            <th>类别名称</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${pagers.datas}" var="data" varStatus="1">
            <tr>
                <td>${data.rowId}</td>
                <td>${data.dirName}</td>
                <td>
                    <div class="btn-group">
                        <a class="button border-main" href="${ctx}/directory/sonFindBySql?fatherId=${data.rowId}"><span
                                class="icon-edit">查看下级分类</span></a>
                        <a class="button border-main" href="${ctx}/directory/edit?rowId=${data.rowId}"><span
                                class="icon-edit">修改</span></a>
                        <a class="button border-red"
                           href="${ctx}/directory/delete?rowId=${data.rowId}&fatherId=${data.fatherId}"><span
                                class="icon-trash-o">删除</span></a>
                    </div>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="8">
                <div class="pagelist">
                    <!--分页开始-->
                    <pg:pager url="${ctx}/directory/sonFindBySql" maxIndexPages="5" items="${pagers.total}"
                              maxPageItems="15"
                              export="curPage=pageNumber">
                        <pg:last>
                            共${pagers.total}记录，共${pageNumber}页，
                        </pg:last>
                        当前第${curPage}页
                        <pg:first>
                            <a href="${pageUrl}&fatherId=${pgfather.rowId}">首页</a>
                        </pg:first>
                        <pg:prev>
                            <a href="${pageUrl}&fatherId=${pgfather.rowId}">上一页</a>
                        </pg:prev>
                        <pg:pages>
                            <c:choose>
                                <c:when test="${curPage eq pageNumber}">
                                    <font color="red">[${pageNumber}]</font>
                                </c:when>
                                <c:otherwise>
                                    <a href="${pageUrl}&fatherId=${pgfather.rowId}">${pageNumber}</a>
                                </c:otherwise>
                            </c:choose>
                        </pg:pages>
                        <pg:next>
                            <a href="${pageUrl}&fatherId=${pgfather.rowId}">下一页</a>
                        </pg:next>
                        <pg:last>
                            <c:choose>
                                <c:when test="${curPage ne pageNumber}">
                                    <a href="${pageUrl}&fatherId=${pgfather.rowId}">尾页</a>
                                </c:when>
                             <%--   <c:otherwise>
                                    <font color="red">尾页</font>
                                </c:otherwise>--%>
                            </c:choose>
                        </pg:last>
                    </pg:pager>
                </div>
            </td>
        </tr>
    </table>
</div>
</body>
</html>

